package com.ithei.date.mydate;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyDate {
    public static void main(String[] args) throws ParseException {
        //当前时间
        Date date=new Date();
        System.out.println(date);
        //北京,第八时区,+8小时,原点:1970/1/1,00:00:00
        Date date1=new Date(3600L*1000);
        System.out.println(date1);
        Date date2=new Date(-3600L*1000*24);
        System.out.println(date2);
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
        String s = sdf.format(date);
        System.out.println(s);
        Date parse = sdf.parse(s);
        System.out.println(parse);
        long l=date.getTime();
        System.out.println(l);
        date1.setTime(3600L*1000*24);
        System.out.println(date1);

    }
}
